﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.IO;
namespace PessMvc.Controllers
{
    public class HomeController : Controller
    {
        //
        // GET: /Home/

        public ActionResult Index()
        {
            var browser = Request.Browser;
            string s = "Browser Capabilities"
                + "Type = " + browser.Type + ","
                + "Name = " + browser.Browser + ","
                + "Version = " + browser.Version + ","
                + "Major Version = " + browser.MajorVersion + ","
                + "Minor Version = " + browser.MinorVersion + ","
                + "Platform = " + browser.Platform + ","
                + "Is Beta = " + browser.Beta + ","
                + "Is Crawler = " + browser.Crawler + ","
                + "Is AOL = " + browser.AOL + ","
                + "Is Win16 = " + browser.Win16 + ","
                + "Is Win32 = " + browser.Win32 + ","
                + "Supports Frames = " + browser.Frames + ","
                + "Supports Tables = " + browser.Tables + ","
                + "Supports Cookies = " + browser.Cookies + ","
                + "Supports VBScript = " + browser.VBScript + ","
                + "Supports JavaScript = " +
                    browser.EcmaScriptVersion.ToString() + ","
                + "Supports Java Applets = " + browser.JavaApplets + ","
                + "Supports ActiveX Controls = " + browser.ActiveXControls
                      + ","
                + "Supports JavaScript Version = " +
                    browser["JavaScriptVersion"] + ",";
            
            return View(s);
        }
        [Authorize]
        public FileResult Download(string filename)
        {            
            string fullName = Path.Combine(Server.MapPath("~/App_Data/templates/"), filename);
            byte[] fileBytes = PessMvc.Helpers.Utility.GetFile(fullName);
            return File(fileBytes, System.Net.Mime.MediaTypeNames.Application.Octet, filename);
        }

        [Authorize(Roles="Admin")]
        public ActionResult SystemSettings()
        {
            return View();
        }
    }
}
